<?php

class Cita extends DBAbstractModel {

  public $fecha;
  public $hora;
  public $direccion;
  
   function save() {
        $this->query = '';
        $this->query = "INSERT INTO citas_peritos (fecha,hora,direccion) VALUES ";
        $this->query.="('$this->fecha', '$this->hora', '$this->direccion');";
        echo "query insertar: " . $this->query . "</br>";
        $this->execute_single_query();
    }
function delete($key) {

        $this->query = '';
        $this->query = "DELETE FROM citas_peritos WHERE fecha='$key'";
        echo "query eliminar: " . $this->query . "</br>";
        $this->execute_single_query();
    }
    
    function update($key) {
        $this->query = '';
        $this->query = "UPDATE  citas_peritos SET fecha='$this->fecha',";
        $this->query.=" hora='$this->hora', direccion='$this->direccion' WHERE  fecha='$key'";
               
        echo "query actualizar: " . $this->query . "</br>";
        $this->execute_single_query();
    }
    
     function get($key) {
        if ($key != ''):
            $this->query = "SELECT *FROM citas_peritos WHERE fecha = '$key'";
            $this->get_results_from_query();
        endif;
    }
    function getAll() {
        $this->query = "SELECT *FROM citas_peritos";
        $this->get_results_from_query();
    }

}

?>
